<include file="Public:head"/>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>需求列表</h5>
                    <div class="ibox-tools" style="margin-top: -9px;">
                        <a href="javascript:location.reload();" class="btn btn-primary"><i class="fa fa-refresh"></i> 刷新</a>
                    </div>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-sm-3">

                        </div>
                        <form class="form-inline" action="" method="get">
                            <div class="col-sm-10 pull-right">
                                <div class="input-group col-sm-3  pull-right">
                                    <input type="text" name="user_nickname" value="{$user_nickname}" placeholder="用户昵称" class="input-sm form-control select_no_border">
                                    <span class="input-group-btn">
                                      <button type="submit" class="btn btn-sm btn-primary"> 搜索</button>
                                    </span>
                                </div>
                                <div class="input-group col-sm-3  pull-right">
                                    <input type="text" name="circle_name" value="{$circle_name}" placeholder="需求圈标题" class="input-sm form-control select_no_border">
                                </div>
                                <div class="input-group col-sm-3  pull-right">
                                    <input type="text" name="user_id" value="{$user_id}" placeholder="用户id" class="input-sm form-control select_no_border">
                                </div>
                                <div class="input-group col-sm-2 pull-right select_width">
                                    <select name="type" class="input-sm form-control select_no_border">
                                        <option value="">需求类别</option>
                                        <option value="1" <if condition="$type eq '1'">selected = selected"</if>>买手圈</option>
                                        <option value="2" <if condition="$type eq '2'">selected = selected"</if>>需求圈</option>
                                    </select>
                                </div>
                            </div>
                        </form>
                    </div>

                    <br />

                    <div class="table-responsive">
                        <form action="__URL__/operate" method="post" id="operate_form">
                            <table class="table table-bordered table-hover"
                                   id="categoryTable">
                                <thead>
                                <tr class="active">
                                    <th><input onclick="choosebox(this)" type="checkbox" value=""/></th>
                                    <th height="40">编号</th>
                                    <th>需求圈标题</th>
                                    <th>用户</th>
                                    <th>用户头像</th>
                                    <th>需求地址</th>
                                    <th>需求备注</th>
                                    <th>是否首页显示</th>
                                </tr>
                                </thead>
                                <tbody>
                                <volist name="data" id="vo">
                                    <tr>
                                        <td><input type="checkbox" name="cid[]" value="{$vo['id']}" /></td>
                                        <td>{$vo.id}</td>
                                        <td>{$vo.circle_name}</td>
                                        <td>{$vo.nickname}</td>
                                        <td><img src="{$vo.headimage}" width="100" height="100"></td>
                                        <td>{$vo.address}</td>
                                        <td>{$vo.remarks}</td>
                                        <td><if condition="$vo.is_index eq 1">显示<else />不显示</if></td>
                                    </tr>
                                </volist>

                                </tbody>
                            </table>
                        </form>
                        <a class="btn btn-white btn-bitbucket index_edit" href="javascript:void(0)" value="1">
                            <i class="fa fa-home"></i> 首页推荐
                        </a>
                        <a class="btn btn-white btn-bitbucket index_edit" href="javascript:void(0)" value="0">
                            <i class="fa fa-home"></i> 取消首页推荐
                        </a>
                        <div class="col-sm-12" style="padding:0px;">
                            <ul class="pagination  pull-right">
                                {$page}
                            </ul>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="__STATIC__/laydate/laydate.js"></script>
<script>
    //日期范围
    laydate.render({
        elem: '#time'
        ,range: true
    });

    function choosebox(o){
        var vt = $(o).is(':checked');
        if(vt){
            $('input[type=checkbox]').prop('checked',vt);
        }else{
            $('input[type=checkbox]').removeAttr('checked');
        }
    }

    $(".index_edit").click(function(){
        var cid = [];
        $("input[name='cid[]']:checked").each(function(){
            var val = $(this).val();
            if(val != ''){
                cid.push(val);
            }

        });
        var update_index = $(this).attr('value');
        $.post("{:url('Circle/index')}",{update_index:update_index,cid:cid},function(result){ 


                if(result.code == '0'){
                    parent.layer.alert(result.msg);
                }else{
                    parent.layer.msg(result.msg,{
                                icon:1,
                                time:1000,
                            },
                            function (index, item) {
                                location.reload();
                            });
                }
        },'json');

        

    });
</script>

</body>

</html>